repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Testing some geometry routines in C++
[andmenj-acm.git]
/
11507 - Bender B. Rodríguez Problem
/
b.cpp
blob
80916962f78eac8cfdf2cdaa6a1b91d666d28de5
1
/*
2
Accepted
3
*/
4
#include<iostream>
5
#include<string>
6
#include<cassert>
7
8
using namespace
std
;
9
int
encode
(
string s
){
10
if
(
s
==
"+y"
)
return
0
;
11
if
(
s
==
"-y"
)
return
1
;
12
if
(
s
==
"+z"
)
return
2
;
13
if
(
s
==
"-z"
)
return
3
;
14
assert
(
0
);
15
}
16
string
decode
(
int
n
){
17
if
(
n
==
0
)
return
"+y"
;
18
if
(
n
==
1
)
return
"-y"
;
19
if
(
n
==
2
)
return
"+z"
;
20
if
(
n
==
3
)
return
"-z"
;
21
if
(
n
==
4
)
return
"+x"
;
22
if
(
n
==
5
)
return
"-x"
;
23
assert
(
0
);
24
}
25
int
main
(){
26
//assert(freopen("bender.in", "r", stdin) != NULL); int move[6][4]={{5,4,0,0},
27
{
4
,
5
,
1
,
1
},
28
{
2
,
2
,
5
,
4
},
29
{
3
,
3
,
4
,
5
},
30
{
0
,
1
,
2
,
3
},
31
{
1
,
0
,
3
,
2
}};
32
int
n
;
33
while
(
cin
>>
n
&&
n
){
34
int
s
=
4
;
35
string in
;
36
for
(
int
i
=
1
;
i
<
n
;++
i
){
37
cin
>>
in
;
38
if
(
in
!=
"No"
){
39
s
=
move
[
s
][
encode
(
in
)];
40
}
41
}
42
cout
<<
decode
(
s
)<<
endl
;
43
}
44
return
0
;
45
}